package com.mademoisellegeek.carrentalsimulation;

public class Travel implements Cloneable {
    
    private int id;
    private String startTown;
    private String endTown;
    private int startDay;
    private int endDay;

    public Travel(int id, String startTown, String endTown, int startDay, int endDay) {
        this.id = id;
        this.startTown = startTown;
        this.endTown = endTown;
        this.startDay = startDay;
        this.endDay = endDay;
    }
    
    public Travel(String startTown, String endTown, int startDay, int endDay) {
        this.startTown = startTown;
        this.endTown = endTown;
        this.startDay = startDay;
        this.endDay = endDay;
    }
    
    @Override
    public Object clone() {
        Travel obj = new Travel(this.id, this.startTown, this.endTown, this.startDay, this.endDay);
        return obj;
    }

    public int getEndDay() {
        return endDay;
    }

    public void setEndDay(int endDay) {
        this.endDay = endDay;
    }
    
    public String getEndTown() {
        return endTown;
    }

    public int getStartDay() {
        return startDay;
    }

    public void setStartDay(int startDay) {
        this.startDay = startDay;
    }

    public String getStartTown() {
        return startTown;
    }
    
    public int length() {
        return this.endDay - this.startDay;
    }
    
    @Override
    public String toString() {
        return "Travel from " + startTown + " to " + endTown +
                " from the " + startDay + " to the " + endDay;
    }
    
}
